package cc3002;

/**
 * A non-calorie-giver Weird Food. It rises your Health State to a better state. Vitamins can be
 * "bitten" thrice but its effect only works for a random times.
 * @author Anibal Llanos Prado
 *
 */
public class Vitamin extends WeirdFood{
	protected int vitaminPower;
	
	/**
	 * Creates a Vitamin that can be eaten thrice with effectiveness on the first "random" bites.
	 */
	public Vitamin(){
		this.vitaminPower=(int)(Math.random()*10);
		this.remainingBites=1;
		this.name="Vitamin";
		this.caloriesPerBite=(-500);
	}
	
	/**
	 * Bites the food. This method is overridden to modify it behavior. Only decides if you'll
	 * get better or don't.
	 * @param health The Health State of the biter.
	 */
	@Override
	public int bite(HealthState health){
		assert remainingBites!=0:"Nothing to eat";
		if(this.calories>500){
			if(vitaminPower!=0)
				if(health.getState()!=6) 
					health.getBetter();
			--remainingBites;
			return (-500);
		}
		else return 0;
	}
}
